package com.seocoo.worker.user.account.model;

import com.seocoo.worker.base.http.BasePageRsp;
import com.seocoo.worker.user.account.entity.EMoney;
import com.seocoo.worker.user.account.model.req.ReqAccountOrd;
import com.seocoo.worker.user.account.model.req.ReqCapitalAccount;
import com.seocoo.worker.user.account.model.req.ReqChenkDeposit;
import com.sfh.lib.HandleException;
import com.sfh.lib.IResult;
import com.sfh.lib.mvvm.BaseViewModel;

public class AccountModel extends BaseViewModel {

    /***
     * 我的帐户
     */
    public void capitalAccount(){
        this.execute(true, new ReqCapitalAccount(), eAccountBaseRsp -> {
            if (eAccountBaseRsp.success()){
                setValue("onCapitalAccount",eAccountBaseRsp.getData());
            }else {
                showDialogToast(eAccountBaseRsp.getMsg());
            }
        });
    }
    /***
     * 提现校验 是否在提现日期
     */
    public void queryChenkDeposit(){
        this.execute(true, new ReqChenkDeposit(), eAccountBaseRsp -> {
            setValue("onChenkDepositSuccess",eAccountBaseRsp);
        });
    }
    /***
     * 资金收支明细
     */
    public void queryMoneyList(int nowPage){
        this.execute(new ReqAccountOrd(nowPage), new IResult<BasePageRsp<EMoney>>() {
            @Override
            public void onFail(HandleException e) {
                setValue("onPageSuccess");
            }

            @Override
            public void onSuccess(BasePageRsp<EMoney> eMoneyBasePageRsp) throws Exception {
                setValue("onPageSuccess",eMoneyBasePageRsp);
            }
        });
    }
}
